#/usr/bin/env python
# -*- coding: utf8 -*-
# title       :
# description :
# author      :'ShenMeng'

import maya.cmds as cmds
import pymel.core as pmel

class Validation(object):
    name = u'SameName | 重名检查'
    dataDict = dict()

    def execute(self):
        self.dataDict = {}
        nameDict = {}
        for obj in pmel.ls(type='mesh'):
            longName = obj.getParent().longName()
            shotName = longName.split('|')[-1]
            if nameDict.get(shotName, False):
                if self.dataDict.get(shotName, False):
                    self.dataDict[shotName].append(longName)
                else:
                    self.dataDict[shotName] = [nameDict[shotName], longName]
            else:
                nameDict[shotName] = longName
        return self.dataDict

    def search(self, obj):
        cmds.select(self.dataDict[obj])